package com.yanqu.road.server.cmd.wingroom;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.wingroom.WingRoomProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.wingroom.WingRoomModule;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_WING_ROOM_CROSS_GET_VISIT_REWARD_RESP, desc = "领取拜访结束奖励返回")
public class CrossGetVisitRewardCmdFromCross extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {

        WingRoomProto.CrossGetVisitRewardRespMsg respMsg = WingRoomProto.CrossGetVisitRewardRespMsg.parseFrom(packet.getBytes());

        player.getModule(WingRoomModule.class).sendVisitRewardMail(player, respMsg.getReward(), respMsg.getHomeUserServerId(), respMsg.getNickName());

        //v4.8
        player.getModule(WingRoomModule.class).calVisitRedDot(WingRoomProto.UserWingRoomRedDotSync.newBuilder());
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
